#ifndef GFS_SPIFLAG_BSD
#define GFS_SPIFLAG_BSD

#define GTREE_FILE_ERR_RECORD

#ifdef GTREE_FILE_ERR_RECORD
extern u32	SaveDataErr,SaveHearErr,SaveGlobalErr;
extern u32 gfs_erase_times,gfs_erase_Global;
#endif

//=========================Flash 参数===========================
#define FLASH_TOTAL_START	0x00000000
#define FLASH_TOTAL_SIZE     (8 * 1024 * 1024) // 64Mbit = 8MB

#define FLASH_PAGE_SIZE      256
#define FLASH_SECTOR_SIZE    4096
#define FLASH_BLOCK32_SIZE   (32*FLASH_SECTOR_SIZE)
#define FLASH_BLOCK64_SIZE   (64*FLASH_SECTOR_SIZE)

//-------------------------FLASH_TOTAL_SIZE(8M)------------------------------------------
#define GFS_MAX_BLOCK				(FLASH_TOTAL_SIZE/FLASH_SECTOR_SIZE)
//-----------------终端参数区(永不丢失数据区：前64K)---------------------------------
#define GFS_PAR_ADDR				(0)
#define GFS_PAR_SIZE				(16)
//--------------8M-16*4096-32*4096-8000K-7.8125M-----------------------------
#define GFS_FILE_START				(16)				//SPI_BLOCK_SIZE->
#define GFS_FILE_SIZE				(GFS_MAX_BLOCK-GFS_PAR_SIZE)	//7.8M
#define GFS_FILE_HDNM				(32)				//SPI_BLOCK_SIZE/SPI_SECTOR_SIZE
	


extern int SPI_Flash_init(void);
extern int SPI_Flash_Deinit(void);
extern int SPI_Flash_Exist(void);

extern int SPI_Flash_ERASE_SECTOR(u32 addr);
extern int SPI_Flash_ERASE_16Block(u32 addr);	
extern int SPI_Flash_ERASE_ALL();

extern int SPI_Flash_Read(u32 addr, void* buf, int size);
extern int SPI_Flash_Write(u32 addr, void* buf, int Len);




#endif

